package ex.app.system.action;


import com.fzy.core.acegi.UserDetailsImpl;
import com.fzy.core.webwork.BaseAction;
import com.opensymphony.xwork.ActionContext;
import com.opensymphony.xwork.Preparable;

import ex.app.system.service.LoginService;

public class OutSideLoginAction extends BaseAction implements  Preparable{	
	/**
	 * 
	 */
	private static final long serialVersionUID = 8144546222971926704L;	
	String loginName;
	String passWord;
	
	LoginService loginService;
	public String execute() throws Exception {	
		UserDetailsImpl u = loginService.getOutsideUser(getLoginName());	
		if(u == null){			
			return "dispatcher:outside_login.jsp?error=1";
		}else{
			String username=u.getLoginName();
			return "redirect:/j_acegi_security_check?j_username="+username+"&j_password="+getPassWord()+"&j_userflag=1";
		}			
	}	
	
	public String getLoginName() {
		return loginName;
	}
	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}
	public String getPassWord() {
		return passWord;
	}
	public void setPassWord(String passWord) {
		this.passWord = passWord;
	}
	
	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}

	public void prepare() throws Exception {
		
	}
}
